var count_down=0;
var num1='',num2='',num3='',num4='',num5='',num6='',nums='';
var close_times=0;//闂滅洡鐨勭鏁�
var game_id='0';//灞€ID
var sbhistory_xml; //
var user_quota_str="";
var io_check_tag=false;

function makeRequest(url,type){
    //console.log(url);
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    }else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
    }
    if(type == ""){
        http_request.onreadystatechange = alertContents;
    }else if(type == "change_game"){
        http_request.onreadystatechange = function() {alertChangeGame();};
    }else{
        http_request.onreadystatechange = function() {alertContents(type);};
    }
    http_request.open('GET', url , true);
    http_request.send(null);

}
function alertContents(type) {
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            if(type=="sbhistory"){
                var xmldoc = http_request.responseXML;
                sbhistory_xml=xmldoc;
            }else if(type=="user_uota"){
                user_quota_str = http_request.responseText;
                //parent.mainFrame.OrderFrame.showUserQuotaInfo();//old_frame
                mainFrame.OrderFrame.showUserQuotaInfo();//new_iframe
            }else{
                var result_txt = http_request.responseText;
                var ndata=result_txt.split(",");
                num1=ndata[0];
                num2=ndata[1];
                num3=ndata[2];
                num4=ndata[3];
                num5=ndata[4];
                num6=ndata[5];
                nums=ndata[6];
            }
        } else {

        }
    }
}
function alertChangeGame() {
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            response = http_request.responseText;
            eval(response);
            //document.getElementById('header_linkss').innerHTML = link_html;
            document.getElementById('new_game').innerHTML = new_game;
        }
    }
}
function myTimer(){
    var d = new Date();
    var nows = d.getHours()*60*60 + d.getMinutes()*60 + d.getSeconds();
    if(nows > close_times && close_times>0){
    }else{
        window.setTimeout("myTimer()", 1000);
    }
}
function userQuotaInfo(){
    makeRequest('/app/user_info/user_quota.php?'+url,'user_uota');
}
function change_game(urls,game_code){
    document.getElementById("game_code").value=game_code;
    makeRequest('chang_game.php?'+urls,'change_game');
}
function get_result_history(urls){
    makeRequest('/app/result/resultCCRU.php?'+urls,'sbhistory');
}


function kd_changegame(game_key,game_href){
    try{
        parent.mainFrame.IndexFrame.change_play(game_key);
    }catch(e){

        try{
            document.getElementById('mainFrame').contentWindow.document.getElementById('IndexFrame').contentWindow.change_play(game_key);
        }catch(e){

            var mainFrameObj=document.getElementById('mainFrame');
            mainFrameObj.src=game_href+url+"&play_code="+game_key;
        }
    }
}


function show_sub_win(url,title){
    $("#SubWinTitle").html(title);
    document.getElementById('sub_iframe').src=url;
    $('#SubWinModal').modal('show').css({
        width: function(){
            return $(this).width() ;
        } + 'px'
    });
}

function showPasswordModal(url){
    document.getElementById('PassWordIframe').src=url;
    $("#PassWordModal").modal("show");

    //IE9
    if($.browser.msie && 10 > $.browser.version) {
        $("#PassWordModal > .modal-dialog").css({"width":"600px","margin":"30px auto"});
    }
}

function showQuickGoldModal(url){
    document.getElementById('QuickGoldframe').src=url;
    $("#QuickGolddModal").modal("show");

    //IE9
    if($.browser.msie && 10 > $.browser.version) {
        $("#QuickGolddModal > .modal-dialog").css({"width":"600px","margin":"30px auto"});
    }
}

function show_quickgold_win(url,title,width){
    try{
        var pwin=document.getElementById('mainFrame').contentWindow.document.getElementById('IndexFrame').contentWindow;
        pwin.document.getElementById('show_div').style.display='none';
        pwin.document.getElementById('show_back').style.display='none';

    }catch(e){}
    document.getElementById('sub_iframe').src=url;
    if(width!=undefined && width!=""){
        document.getElementById('show_tb').style.width=width+'px';
        document.getElementById('show_table').style.width=width+'px';
    }else{
        width=900;
        document.getElementById('show_tb').style.width=width+'px';
        document.getElementById('show_table').style.width=width+'px';
    }
    document.getElementById('show_div').style.display='';
    document.getElementById('show_back').style.display='';
}

function AutoIoCheckTag(){
    try{
        io_check_tag=mainFrame.OrderFrame.document.getElementById("io_check").checked;
    }catch(e){
        io_check_tag=mainFrame.IndexFrame.document.getElementById("io_check").checked;
    }
}

function AutoIoChecked(){
    try{
        mainFrame.OrderFrame.document.getElementById("io_check").checked=io_check_tag;
    }catch(e){
        mainFrame.IndexFrame.document.getElementById("io_check").checked=io_check_tag;
    }
}



function show_info(type){
    if(type=='1'){
        document.getElementById('info').style.display='';
    }else {
        document.getElementById('info').style.display='none';
    }

}

function show_report(type){
    if(type=='1'){
        document.getElementById('report').style.display='';

    }else {
        document.getElementById('report').style.display='none';

    }

}











